SPRITE COLLISION

This command will return a one if the specified sprite is overlapping the target sprite specified.

  Syntax
Return Integer=SPRITE COLLISION(Sprite Number, Target Sprite Number)
  Parameters
Sprite Number
Integer
The sprite number
Target Sprite Number
Integer
The target sprite number, and if a target sprite has not been specified and a value of zero has been used, this command will return the sprite number of any sprite overlapping it

  Returns

This value is an integer number such as 1.

  Description

If a target sprite has not been specified and a value of zero has been used, this command will return the sprite number of any sprite overlapping it. The parameters should be specified using integer values.

  Example Code
cls
load image "man.bmp",1
sprite 1,100,100,1
sprite 2,100,110,1
wait 1000*8
do
paste sprite 1,mousex(),mousey()
num=sprite collision(1,0)
if num>0
cls
cls
print "we have it sprite number "+str$(num)cls
endif
cls
loop
end
  See also

SPRITE Commands Menu
Index